package com.z996.spring6;

import com.z996.spring6.pojo.User;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 简述:<br>
 * 实验十一：bean 的 生命周期
 *
 * @Author zfh18
 * @Date 2024-02-02 15:27
 * @Version 1.0
 **/
public class DILifeCycleTest {
    private Logger logger = LoggerFactory.getLogger(DILifeCycleTest.class);


    /**
     * @Description 了解 bean的生命周期
     * @Author zfh18
     * @Date 15:38 2024-02-02
     **/
    @Test
    public void testByClass() {

        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("bean-DI-LifeCycle.xml");
        User user = context.getBean(User.class);
        logger.info("生命周期:⑤-->bean对象使用:\n{}", user);
        context.close();
    }

}
